﻿using System;
using IrrKlang;
using Vol;

namespace Voize
{
    internal class CSound
    {
        internal CSound(ISound snd)
        {
            m_SoundInfo = snd;
        }


        private ISound m_SoundInfo;
       


        internal float CurrentPanValue
        {
            get { return m_SoundInfo.Pan; }
        }


        internal float CurrentVolumeLevel
        {
            get { return m_SoundInfo.Volume; }
        }


        internal float CurrentPlaybackSpeed
        {
            get { return m_SoundInfo.PlaybackSpeed; }
        }

        /// <summary>
        /// Internal method. With Volume control use SetVolumeLevel(double value) instead
        /// </summary>
        /// <param name="value">New volume level</param>
        internal void SetVolumeLevel(int value)
        {
            if (value >= 0 && value <= 10)
            {
                if (m_SoundInfo != null)
                {
                    float val;
                    val = (float)value / (float)10;
                    m_SoundInfo.Volume = val;
                }
            }
        }
       
        internal void SetPan(int value)
        {
            if (value >= -10 && value <= 10)
            {
                if (m_SoundInfo != null)
                {
                    float val;
                    val = (float)value / (float)10;
                    m_SoundInfo.Pan = val;
                }
            }

        }



        internal void SetPlayingSpeed(int value)
        {
            if (value >= 1 && value <= 10)
            {
                if (m_SoundInfo != null)
                {
                    float val;
                    val = (float)value / (float)10;
                    m_SoundInfo.PlaybackSpeed = val;
                }
            }

        }



    }
}
